﻿<Window x:Class="Predica.FimExplorer.UI.WPF.Main.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Predica FIM Explorer" Height="600" Width="1200">
    <Grid>
        <Grid x:Name="mainContainer">
            <Grid.RowDefinitions>
                <RowDefinition Height="100" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="350" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Row="0" Grid.Column="0">
                <StackPanel Orientation="Horizontal">
                    <TextBox 
                        Width="250"
                        Height="40"
                        TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"
                        Text="{Binding XPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        />
                    <Button Content="Run query" Click="btnRunQuery_Click" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBox Width="250"
                        x:Name="tbIdToFind"
                        Text="{Binding IdForSearch, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             />
                    <Button Content="Find by ID" Click="btnFindById_Click" />
                </StackPanel>
                <Button Click="btnExportXml_Click">Export to XML</Button>
                <Button Click="btnImportXml_Click">Import XML</Button>
            </StackPanel>
            <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
                <ListBox ItemsSource="{Binding ObjectTypes}"
                    SelectedItem="{Binding SelectedObjectType, Mode=TwoWay}"
                    DisplayMemberPath="DisplayName" />
                <ListBox 
                    ItemsSource="{Binding CurrentAttributes}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox
                                Content="{Binding Attribute.DisplayName}"
                                IsChecked="{Binding IsSelected,Mode=TwoWay}"
                                />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
            <DataGrid 
                Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
                SelectionUnit="FullRow"
                IsReadOnly="True"
                ItemsSource="{Binding QueriedValues}" 
                SelectedItem="{Binding SelectedRow,Mode=TwoWay}" 
                AutoGeneratingColumn="DataGrid_AutoGeneratingColumn"
                AutoGeneratedColumns="DataGrid_AutoGeneratedColumns"
                MouseDoubleClick="DataGrid_MouseDoubleClick" />
        </Grid>
        <Grid x:Name="loadingIndicator" 
              Visibility="Collapsed" Opacity="0.5" Background="Black">
        </Grid>
    </Grid>
</Window>